home *** CD-ROM | disk | FTP | other *** search
/ Aminet 41 / Aminet 41 (2001)(Schatztruhe)[!][Feb 2001].iso / Guides / PicsData / Rexx / PZ_MakeIFF_HAM8.rexx < prev    next >
OS/2 REXX Batch file  |  1993-11-11  |  2KB  |  126 lines

  1. /*
  2. **  $VER: $Id: PZ_MakeIFF_HAM8.rexx,v 5.0 1993/11/12 01:14:26 chris Exp $
  3. **  Copyright (C) 1992, 1993 by Christian A. Weber, Zürich, Switzerland.
  4. **  REXX script internally used by PicZoo. Do not start manually.
  5. **
  6. **  You may wish to change MAXMEM for ADPro if you don't have enough RAM,
  7. **  and the delay after loading if you have a slow HD :)
  8. */
  9.  
  10. options results
  11. arg adprodir filename destname maxwidth maxheight
  12. address 'ADPro'
  13.  
  14.  
  15. /*
  16. ** Set the desired screen dimensions. If we don't set them manually, we get
  17. ** the current text overscan values, which is just what we want!
  18. */
  19.  
  20. /* maxwidth  = 704 */
  21. /* maxheight = 468 */
  22.  
  23.  
  24. /*
  25. ** Make sure ADPro is running
  26. */
  27. IF ~show(ports,'ADPro') THEN
  28. DO
  29.     Address COMMAND 'C:Assign ADPRO: '||adprodir
  30.     Address COMMAND 'Run >NIL: ADPRO:ADPro MAXMEM=5000000 BEHIND'
  31.     Address COMMAND 'C:Wait 5'
  32.     IF ~show(ports,'ADPro') THEN EXIT
  33. END
  34.  
  35.  
  36. /*
  37. ** Screen types for ADPro
  38. */
  39. LORES        = 0
  40. HIRES        = 1
  41. LACE        = 2
  42. PAL        = 4
  43. XOVERSCAN    = 8
  44. YOVERSCAN    = 16
  45.  
  46.  
  47. /*
  48. ** Now load the picture ...
  49. */
  50. PSTATUS        UNLOCKED
  51. SCREEN_TYPE    LORES
  52. LFORMAT        'UNIVERSAL'
  53. LOAD        filename
  54.  
  55. IF RC == 0 THEN DO
  56.  
  57.     /*
  58.     ** Get the picture size
  59.     */
  60.     XSIZE
  61.     origwidth  = (ADPRO_RESULT*11) / 10    /* Correct aspect ratio for Amiga */
  62.     YSIZE
  63.     origheight = ADPRO_RESULT
  64.  
  65.  
  66.     /*
  67.     ** Now determine the new width and height, so the picture fits
  68.     ** into maxwidth/maxheight
  69.     */
  70.     width  = maxwidth
  71.     height = (origheight * maxwidth) / origwidth
  72.  
  73.     IF height > maxheight THEN DO
  74.         width  = (origwidth * maxheight) / origheight
  75.         height = maxheight
  76.     END
  77.  
  78.  
  79.     /*
  80.     **  Now set the parameters for the screenmode depending on the picture's
  81.     **  type (GRAY or COLOR)
  82.     */
  83.     IMAGE_TYPE
  84.     IF WORD(ADPRO_RESULT,1) = "GRAY" THEN DO
  85.         POFFSET        0
  86.         PTOTAL        16
  87.         PUSED        16
  88.         PTOTAL        16
  89.         RENDER_TYPE    16
  90.         SCREEN_TYPE    HIRES + LACE + XOVERSCAN + YOVERSCAN
  91.     END
  92.     ELSE DO
  93.         POFFSET        0
  94.         PUSED        64
  95.         PTOTAL        HAM8
  96.         PUSED        64
  97.         RENDER_TYPE    HAM8
  98.         SCREEN_TYPE    HIRES + LACE + XOVERSCAN + YOVERSCAN
  99.     END
  100.  
  101.  
  102.     /*
  103.     ** Make sure we get the best dynamic range
  104.     */
  105.     OPERATOR    DYNAMIC_RANGE 0 255
  106.  
  107.  
  108.     /*
  109.     ** Scale the image and render it
  110.     */
  111.     ABS_SCALE    width height
  112.     DITHER        1        /* Floyd-Steinberg */
  113.     EXECUTE
  114.  
  115.     /*
  116.     ** Now save the result as IFF in the user's IFF directory
  117.     */
  118.     SFORMAT        IFF
  119.     SAVE        destname IMAGE
  120.  
  121. END
  122. ELSE DO
  123.     say filename || ': not a picture'
  124. END
  125.  
  126.